package com.general.framework.core.enums;

import com.general.framework.core.lang.Strings;
import lombok.Getter;

import java.util.Objects;

/**
 * 登录用户类型定义
 * 1后台管理用户，2后台商家用户，3APP用户，4APP商家
 * @author wanzuwang team
 */
@Getter
public enum ContextUserType implements IEnum<Integer> {

    APP_USER(      0, "移动端-用户"),
    APP_MERCHANT_MANAGER(     1, "移动端-回收商"),
    APP_MERCHANT_QUOTATION(     2, "移动端-报价师"),

    APP_STORE_MANAGER(     3, "移动端-门店店长"),

    APP_STORE_EMPLOYEE(     4, "移动端-门店员工"),

    APP_CLERK(     5, "移动端-业务员"),

    ADMIN_PLATFORM(10, "平台-管理用户"),

    ADMIN_PARTNER(20, "平台-合作商"),

    ADMIN_PROXY(30, "平台-代理商");
    ;

    ContextUserType(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    private Integer value;

    private String desc;

    @Override
    public Integer value() {
        return this.value;
    }

    @Override
    public String named() {
        return this.desc;
    }

    public static String getDesc(Integer value) {
        for (ContextUserType thisEnum : ContextUserType.values()) {
            if (Objects.equals(thisEnum.value, value)) {
                return thisEnum.desc;
            }
        }
        return Strings.EMPTY;
    }
}
